const express = require('express');
const cors = require('cors');
const userRouter = require('./routes/user.js');
const indexRouter = require('./routes/index.js');
const recycleRouter = require('./routes/recycle.js')
const productRouter = require('./routes/product.js')
const newsRouter = require('./routes/news.js')
const carRouter = require('./routes/car.js')
const orderRouter = require('./routes/order.js')
const afterRouter = require('./routes/after.js')
const uploadRouter = require('./routes/upload.js')
// const jwt = require('jsonwebtoken'); //引入jwt模块
let app = express();
const bodyParser = require('body-parser')
const json = express.json({ type: '*/json' });
app.listen(3000,()=>{
	console.log('启动成功');
});
app.use(
	cors({
		origin: '*',
		credentials: true
	})
);

app.use(json);
app.use(express.static('public'));
app.use(bodyParser.urlencoded({extended:false}))
app.use('/v1/user',userRouter);
app.use('/v1/index',indexRouter);
app.use('/v1/recycle',recycleRouter);
app.use('/v1/product',productRouter);
app.use('/v1/news',newsRouter)
app.use('/v1/car',carRouter)
app.use('/v1/order',orderRouter)
app.use('/v1/after',afterRouter)
app.use('/v1/upload',uploadRouter)

